package com.kfm.login.util;

import java.util.Random;
import java.util.UUID;

public class LoginUtils {

    /**
     * 生成不带 - 的uuid
     * @return
     */
    public static String uuid() {
        return UUID.randomUUID().toString().replace("-", "");
    }

    /**
     * 生成 num 位随机验证码
     * @param num
     * @return
     */
    public static String randCode(Integer num) {
        StringBuilder code = new StringBuilder();
        for (int i = 0; i < num; i ++) {
            code.append(new Random().nextInt(10));
        }
        return code.toString();
    }
}
